# Maintainer: Andrea Zagli <andrea.zagli.free@gmail.com>

_realname=devhelp
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=3.8.2
pkgrel=1
arch=('any')
pkgdesc="Remote desktop client for the GNOME Desktop  (mingw-w64)"
options=(strip staticlibs)
depends=("${MINGW_PACKAGE_PREFIX}-gtk3"
         "${MINGW_PACKAGE_PREFIX}-gsettings-desktop-schemas"
         "${MINGW_PACKAGE_PREFIX}-adwaita-icon-theme"
         "${MINGW_PACKAGE_PREFIX}-webkitgtk3"
         "${MINGW_PACKAGE_PREFIX}-python2")
makedepends=("${MINGW_PACKAGE_PREFIX}-gobject-introspection"
             "${MINGW_PACKAGE_PREFIX}-vala")
options=('strip' 'staticlibs')
license=("GPL 2")
url="https://www.gnome.org"
install=${_realname}-${CARCH}.install
source=(https://download.gnome.org/sources/${_realname}/${pkgver%.*}/${_realname}-$pkgver.tar.xz
        001-win.patch)
sha256sums=('a245b53824c6f2ff89245ff807bb2140bde74951ea6f1d759a0fd0c6959ca9f7'
            '0ed77884d958aa94af910591a61f33895a5f6d9b4f7e4852de6ab543d4487b50')

prepare() {
  cd "${srcdir}"/${_realname}-${pkgver}

  patch -b -V simple -p1 -i ${srcdir}/001-win.patch

  ACLOCAL_FLAGS="-I libgd $ACLOCAL_FLAGS" \
    AUTOPOINT='intltoolize --automake --copy' \
    autoreconf -fi
}

build() {
  mkdir -p build-${MINGW_CHOST}
  cd build-${MINGW_CHOST}

  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --libexecdir=${MINGW_PREFIX}/lib \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --build=${MINGW_CHOST} \
    --with-webkit2=no

  make
}

package() {
  cd "$srcdir/build-${MINGW_CHOST}"
  make DESTDIR=$pkgdir install

  install -Dm644 "${srcdir}/${_realname}-${pkgver}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}
